\subsubsection{~Wave model modules} \label{sec:wave_mod}
\vsssub

At the core of the wave model are the wave model initialization module and the
wave model module.

\vspace{\baselineskip} \noindent
Main wave model initialization module \hfill {\file w3initmd.ftn}

\begin{flisti}
\fit{w3init}{The initialization routine {\F w3init}, which
             prepares the wave model for computations (internal).}
\fit{w3mpii}{\mpi\ initialization (internal).}
\fit{w3mpio}{\mpi\ initialization for I/O (internal).}
\fit{w3mpip}{\mpi\ initialization for I/O (internal, point output only).}
\end{flisti}

\noindent
Main wave model module \hfill {\file w3wavemd.ftn}

\begin{flisti}
\fit{w3wave}{The actual wave model {\F w3wave}.}
\fit{w3gath}{Data transpose to gather data for spatial propagation in
             a single array (internal).}
\fit{w3scat}{Corresponding scatter operation (internal).}
\fit{w3nmin}{Calculate minimum number of sea points per processor
             (internal).}
\end{flisti}

\noindent
The main wave model routines and all other subroutines require a data
structure to exist. The data structure is contained in the following modules.

\vspace{\baselineskip} \noindent
Define model grids and parameter settings \hfill {\file w3gdatmd.ftn}

\begin{flisti}
\fit{w3nmod}{Set number of grids to be considered.}
\fit{w3dimx}{Set dimensions for spatial grid and allocate storage.}
\fit{w3dims}{Set dimensions for spectral grid and allocate storage.}
\fit{w3setg}{Set pointers to selected grid.}
\fit{w3dimug}{Set dimensions for arrays specific to the triangle-based grids (grid connectivity ...).}
\fit{w3gntx}{Develop unstructured grid structures.}
\end{flisti}

\noindent
Dynamic wave data describing sea state \hfill {\file w3wdatmd.ftn}

\begin{flisti}
\fit{w3ndat}{Set number of grids to be considered.}
\fit{w3dimw}{Set dimensions and allocate storage.}
\fit{w3setw}{Set pointers to selected grid.}
\end{flisti}

\noindent
Auxiliary storage \hfill {\file w3adatmd.ftn}

\begin{flisti}
\fit{w3naux}{Set number of grids to be considered.}
\fit{w3dima, w3xdma, w3dmnl}{}
\fit{      }{Set dimensions and allocate storage.}
\fit{w3seta, w3xeta}{}
\fit{      }{Set pointers to selected grid.}
\end{flisti}

\pb \noindent
Model output \hfill {\file w3odatmd.ftn}

\begin{flisti}
\fit{w3nout}{Set number of grids to be considered.}
\fit{w3dmo2, w3dmo3, w3dmo5}{}
\fit{      }{Set dimensions and allocate storage.}
\fit{w3seto}{Set pointers to selected grid.}
\end{flisti}

\noindent
Model input \hfill {\file w3idatmd.ftn}

\begin{flisti}
\fit{w3ninp}{Set number of grids to be considered.}
\fit{w3dimi}{Set dimensions and allocate storage.}
\fit{w3seti}{Set pointers to selected grid.}
\end{flisti}


\noindent
The configuration files such as traditional form (.inp) and namelist form (.nml)
are processed differently in the program. The traditional configuration file is
directly read in the main program. The namelist configuration file is read by the 
subroutines in the following modules.

\vspace{\baselineskip} \noindent
Grid preprocessor namelist module \hfill {\file w3nmlgridmd.ftn}

\begin{flisti}
\fit{w3nmlgrid}{Read and report all the namelists.}
\fit{read\_spectrum\_nml}{Init and save values to a derived type.}
\fit{read\_run\_nml}{Init and save values to a derived type.}
\fit{read\_timesteps\_nml}{Init and save values to a derived type.}
\fit{read\_grid\_nml}{Init and save values to a derived type.}
\fit{read\_rect\_nml}{Init and save values to a derived type.}
\fit{read\_curv\_nml}{Init and save values to a derived type.}
\fit{read\_unst\_nml}{Init and save values to a derived type.}
\fit{read\_smc\_nml}{Init and save values to a derived type.}
\fit{read\_mask\_nml}{Init and save values to a derived type.}
\fit{read\_obst\_nml}{Init and save values to a derived type.}
\fit{read\_slope\_nml}{Init and save values to a derived type.}
\fit{read\_sed\_nml}{Init and save values to a derived type.}
\fit{read\_inbound\_nml}{Init and save values to a derived type.}
\fit{read\_excluded\_nml}{Init and save values to a derived type.}
\fit{read\_outbound\_nml}{Init and save values to a derived type.}
\fit{report\_spectrum\_nml}{Output default and user-defined values.}
\fit{report\_run\_nml}{Output default and user-defined values.}
\fit{report\_timesteps\_nml}{Output default and user-defined values.}
\fit{report\_grid\_nml}{Output default and user-defined values.}
\fit{report\_rect\_nml}{Output default and user-defined values.}
\fit{report\_curv\_nml}{Output default and user-defined values.}
\fit{report\_smc\_nml}{Output default and user-defined values.}
\fit{report\_depth\_nml}{Output default and user-defined values.}
\fit{report\_mask\_nml}{Output default and user-defined values.}
\fit{report\_obst\_nml}{Output default and user-defined values.}
\fit{report\_slope\_nml}{Output default and user-defined values.}
\fit{report\_sed\_nml}{Output default and user-defined values.}
\fit{report\_inbound\_nml}{Output default and user-defined values.}
\fit{report\_excluded\_nml}{Output default and user-defined values.}
\fit{report\_outbound\_nml}{Output default and user-defined values.}
\end{flisti}

\vspace{\baselineskip} \noindent
NetCDF boundary conditions namelist module \hfill {\file w3nmlbouncmd.ftn}

\begin{flisti}
\fit{w3nmlbounc}{Read and report all the namelists.}
\fit{read\_bound\_nml}{Init and save values to a derived type.}
\fit{report\_bound\_nml}{Output default and user-defined values.}
\end{flisti}

\vspace{\baselineskip} \noindent
NetCDF input field preprocessor namelist module \hfill {\file w3nmlprncmd.ftn}

\begin{flisti}
\fit{w3nmlprnc}{Read and report all the namelists.}
\fit{read\_forcing\_nml}{Init and save values to a derived type.}
\fit{read\_file\_nml}{Init and save values to a derived type.}
\fit{report\_forcing\_nml}{Output default and user-defined values.}
\fit{report\_file\_nml}{Output default and user-defined values.}
\end{flisti}

\vspace{\baselineskip} \noindent
Generic shell namelist module \hfill {\file w3nmlshelmd.ftn}

\begin{flisti}
\fit{w3nmlshel}{Read and report all the namelists.}
\fit{read\_domain\_nml}{Init and save values to a derived type.}
\fit{read\_input\_nml}{Init and save values to a derived type.}
\fit{read\_output\_type\_nml}{Init and save values to a derived type.}
\fit{read\_output\_date\_nml}{Init and save values to a derived type.}
\fit{read\_homogeneous\_nml}{Init and save values to a derived type.}
\fit{report\_domain\_nml}{Output default and user-defined values.}
\fit{report\_input\_nml}{Output default and user-defined values.}
\fit{report\_output\_type\_nml}{Output default and user-defined values.}
\fit{report\_output\_date\_nml}{Output default and user-defined values.}
\fit{report\_homogeneous\_nml}{Output default and user-defined values.}
\end{flisti}

\vspace{\baselineskip} \noindent
Multi-grid shell namelist module \hfill {\file w3nmlmultimd.ftn}

\begin{flisti}
\fit{w3nmlmultidef}{Set the number of model and forcing grids.}
\fit{w3nmlmulticonf}{Read and report all the namelists.}
\fit{read\_domain\_nml}{Init and save values to a derived type.}
\fit{read\_input\_grid\_nml}{Init and save values to a derived type.}
\fit{read\_model\_grid\_nml}{Init and save values to a derived type.}
\fit{read\_output\_type\_nml}{Init and save values to a derived type.}
\fit{read\_output\_date\_nml}{Init and save values to a derived type.}
\fit{read\_homogeneous\_nml}{Init and save values to a derived type.}
\fit{report\_domain\_nml}{Output default and user-defined values.}
\fit{report\_input\_grid\_nml}{Output default and user-defined values.}
\fit{report\_model\_grid\_nml}{Output default and user-defined values.}
\fit{report\_output\_type\_nml}{Output default and user-defined values.}
\fit{report\_output\_date\_nml}{Output default and user-defined values.}
\fit{report\_homogeneous\_nml}{Output default and user-defined values.}
\end{flisti}

\vspace{\baselineskip} \noindent
Gridded output NetCDF post-processor namelist module \hfill {\file w3nmlounfmd.ftn}

\begin{flisti}
\fit{w3nmlounf}{Read and report all the namelists.}
\fit{read\_field\_nml}{Init and save values to a derived type.}
\fit{read\_file\_nml}{Init and save values to a derived type.}
\fit{read\_smc\_nml}{Init and save values to a derived type.}
\fit{report\_field\_nml}{Output default and user-defined values.}
\fit{report\_file\_nml}{Output default and user-defined values.}
\fit{report\_smc\_nml}{Output default and user-defined values.}
\end{flisti}

\vspace{\baselineskip} \noindent
Point output NetCDF post-processor namelist module \hfill {\file w3nmlounpmd.ftn}

\begin{flisti}
\fit{w3nmlounp}{Read and report all the namelists.}
\fit{read\_point\_nml}{Init and save values to a derived type.}
\fit{read\_file\_nml}{Init and save values to a derived type.}
\fit{read\_spectra\_nml}{Init and save values to a derived type.}
\fit{read\_param\_nml}{Init and save values to a derived type.}
\fit{read\_source\_nml}{Init and save values to a derived type.}
\fit{report\_point\_nml}{Output default and user-defined values.}
\fit{report\_file\_nml}{Output default and user-defined values.}
\fit{report\_spectra\_nml}{Output default and user-defined values.}
\fit{report\_param\_nml}{Output default and user-defined values.}
\fit{report\_source\_nml}{Output default and user-defined values.}
\end{flisti}

\vspace{\baselineskip} \noindent
Track output NetCDF post-processor namelist module \hfill {\file w3nmltrncmd.ftn}

\begin{flisti}
\fit{w3nmltrnc}{Read and report all the namelists.}
\fit{read\_track\_nml}{Init and save values to a derived type.}
\fit{read\_file\_nml}{Init and save values to a derived type.}
\fit{report\_track\_nml}{Output default and user-defined values.}
\fit{report\_file\_nml}{Output default and user-defined values.}
\end{flisti}


\noindent
The input fields such as winds and currents are transferred to the model
through the parameter list of {\F w3wave}. The information is processed within
{\F w3wave} by the routines in the following module.

\vspace{\baselineskip} \noindent
Input update module \hfill {\file w3updtmd.ftn}

\begin{flisti}
\fit{w3ucur}{Interpolation in time of current fields.}
\fit{w3uwnd}{Interpolation in time of wind fields.}
\fit{w3uini}{Generate initial conditions from the initial
             wind field.}
\fit{w3ubpt}{Updating of boundary conditions in nested runs.}
\fit{w3uice}{Updating of the ice coverage.}
\fit{w3ulev}{Updating of water levels.}
\fit{w3utrn}{Updating grid box transparencies.}
\fit{w3ddxy}{Calculation of spatial derivatives of the water depth.}
\fit{w3dcxy}{Calculation of spatial derivatives of the currents.} 
\end{flisti}

\noindent
There are seven types of \ws\ data files (other than the preprocessed input
fields, which are part of the program shall rather than the actual wave
model). The corresponding routines are gathered in six modules.

\vspace{\baselineskip} \noindent
I/O module ({\file mod\_def.ww3}) \hfill {\file w3iogrmd.ftn}

\begin{flisti}
\fit{w3iogr}{Reading and writing of {\file mod\_def.ww3}.}
\end{flisti}

\noindent
I/O module ({\file out\_grd.ww3}) \hfill {\file w3iogomd.ftn}

\begin{flisti}
\fit{w3outg}{Calculation of gridded output parameters.}
\fit{w3iogo}{Reading and writing of {\file out\_grd.ww3}.}
\end{flisti}

\noindent
I/O module ({\file out\_pnt.ww3}) \hfill {\file w3iopomd.ftn}

\begin{flisti}
\fit{w3iopp}{Processing of requests for point output.}
\fit{w3iope}{Calculating point output data.}
\fit{w3iopo}{Reading and writing of {\file out\_pnt.ww3}.}
\end{flisti}

\noindent
I/O module ({\file track\_o.ww3}) \hfill {\file w3iotrmd.ftn}

\begin{flisti}
\fit{w3iotr}{Generate track output in {\file track\_o.ww3}.}
\end{flisti}

\noindent
I/O module ({\file restart.ww3}) \hfill {\file w3iorsmd.ftn}

\begin{flisti}
\fit{w3iors}{Reading and writing of {\file restart{\sl{n}}.ww3}.}
\end{flisti}

\noindent
I/O module ({\file nest.ww3}) \hfill {\file w3iobcmd.ftn}

\begin{flisti}
\fit{w3iobc}{Reading and writing of {\file nest{\sl{n}}.ww3}.}
\end{flisti}

\noindent
I/O module ({\file partition.ww3}) \hfill {\file w3iofsmd.ftn}

\begin{flisti}
\fit{w3iofs}{Writing of {\file partition.ww3}.}
\end{flisti}

\noindent
There are presently several propagation schemes and GSE alleviation techniques
available for rectangular and curvilinear grids, as well as a 'slot' for a
user supplied propagation routine, and there are four schemes for
triangle-based grids. The propagation schemes are packaged in the following
modules.

\vspace{\baselineskip} \noindent
Propagation module (first order, no GSE alleviation) \hfill {\file w3pro1md.ftn}

\begin{flisti}
\fit{w3map1}{Generation of auxiliary maps.}
\fit{w3xyp1}{Propagation in physical space.}
\fit{w3ktp1}{Propagation in spectral space.}
\end{flisti}

\noindent
Propagation module (higher order scheme with GSE diffusion) \hfill {\file
  w3pro2md.ftn}

\begin{flisti}
\fit{w3map2}{Generation of auxiliary maps.}
\fit{w3xyp2}{Propagation in physical space.}
\fit{w3ktp2}{Propagation in spectral space.}
\end{flisti}

\noindent
Propagation module (higher order scheme with GSE averaging) \hfill {\file
  w3pro3md.ftn}

\begin{flisti}
\fit{w3map3}{Generation of auxiliary maps.}
\fit{w3mapt}{Generation of transparency maps.}
\fit{w3xyp3}{Propagation in physical space.}
\fit{w3ktp3}{Propagation in spectral space.}
\end{flisti}

\noindent
Propagation module (slot for user supplied routines) \hfill {\file
w3proxmd.ftn}

\begin{flisti}
\fit{w3xypx}{Propagation in physical space.}
\fit{w3ktpx}{Propagation in spectral space.}
\end{flisti}

\noindent
Propagation module (generic UQ) \hfill {\file w3uqckmd.ftn}

\begin{flisti}
\fit{w3qck{\it{n}}}{Routines performing \uq\ scheme in arbitrary
                 spaces (1: regular grid. 2: irregular grid
                         3: regular grid with obstructions).}
\end{flisti}

\noindent
Propagation module (generic UNO) \hfill {\file w3uqckmd.ftn}

\begin{flisti}
\fit{w3uno, w3unor w3unos}{}
\fit{}{Like UQ schemes above.}
\end{flisti}

\noindent
SMC grid routines \hfill {\file w3psmcmd.ftn}

\begin{flisti}
\fit{W3PSMC   }{Spatial propagation on SMC grid.}
\fit{W3KSMC   }{Spectral modification by GCT and refraction.}
\fit{SMCxUNO2/3 }{Irregular grid mid-flux on U-faces by UNO2/3.}
\fit{SMCyUNO2/3 }{Irregular grid mid-flux on V-faces by UNO2/3.}
\fit{SMCxUNO2r/3r}{Regular grid mid-flux on U-faces by UNO2/3.}
\fit{SMCyUNO2r/3r}{Regular grid mid-flux on V-faces by UNO2/3.}
\fit{SMCkUNO2 }{Shift in k-space due to refraction by UNO2.}
\fit{SMCGradn }{Evaluate field gradient at cell centre.}
\fit{SMCAverg }{1-2-1 weighted average for centre field.}
\fit{SMCGtCrfr}{Refraction and GCT rotation in theta.}
\fit{SMCDHXY  }{Evaluate depth gradient and refraction limiter.}
\fit{SMCDCXY  }{Evaluate current velocity gradient.}
\fit{W3GATHSMC W3SCATSMC}{}
\fit{         }{Gather and scatter spectral components.}
\end{flisti}

\noindent
Triangle-based propagation schemes \hfill {\file w3profsmd.ftn}

\begin{flisti}
\fit{w3xypug}{Interface to the unstructured propagation schemes.}
\fit{w3cflug}{Computes the maximum CFL number for spatial propagation.}
\fit{w3xypfsn2}{N-scheme.}
\fit{w3xypfspsi2}{PSI-scheme.}
\fit{w3xypfsnimp}{Implicit version of the N-scheme.}
\fit{w3xypfsfct2}{FCT-scheme.}
\fit{bcgstab}{Part of the iterative SPARSKIT solver, used for the implicit scheme.}
\end{flisti}

\vspace{\baselineskip} \noindent
The source term calculation and integration is contained in several
modules. The module {\file w3srcemd.ftn} manages the general calculation and
integration. Additional modules contain the actual source term options.

\vspace{\baselineskip} \noindent
Source term integration module \hfill {\file w3srcemd.ftn}

\begin{flisti}
\fit{w3srce}{Integration of source terms.}
\end{flisti}

\noindent
Flux (stress) module (Wu, 1980) \hfill {\file w3flx1md.ftn}

\begin{flisti}
\fit{w3flx1}{Calculation of stresses.}
\end{flisti}

\noindent
Flux (stress) module (Tolman and Chalikov) \hfill {\file w3flx2md.ftn}

\begin{flisti}
\fit{w3flx2}{Calculation of stresses.}
\end{flisti}

\noindent
Flux (stress) module (Tolman and Chalikov, capped) \hfill {\file w3flx3md.ftn}

\begin{flisti}
\fit{w3flx3}{Calculation of stresses.}
\end{flisti}

\noindent
Flux (stress) module (slot for user supplied routines) \hfill {\file
w3flxxmd.ftn}

\begin{flisti}
\fit{w3flxx}{Calculation of stresses.}
\fit{inflxx}{Initialization routine.}
\end{flisti}

\noindent
Linear input (Cavaleri and Malanotte Rizzoli) \hfill {\file w3sln1md.ftn}

\begin{flisti}
\fit{w3sln1}{Calculation $S_{lin}$.}
\end{flisti}

\pb \noindent
Linear input (slot for user supplied routines) \hfill {\file w3slnxmd.ftn}

\begin{flisti}
\fit{w3slnx}{Calculation $S_{lin}$.}
\fit{inslnx}{Corresponding initialization routine.}
\end{flisti}

\noindent
Input and dissipation module (dummy version) \hfill {\file w3src0md.ftn}

\begin{flisti}
\fit{w3spr0}{Calculation of mean wave parameters (single grid point).}
\end{flisti}

\noindent
Input and dissipation module (\wam-3) \hfill {\file w3src1md.ftn}

\begin{flisti}
\fit{w3spr1}{Calculation of mean wave parameters (single grid point).}
\fit{w3sin1}{Calculation of $S_{in}$.}
\fit{w3sds1}{Calculation of $S_{ds}$.}
\end{flisti}

\noindent
Input and dissipation module Tolman and Chalikov 1996 \hfill {\file w3src2md.ftn}

\begin{flisti}
\fit{w3spr2}{Calculation of mean wave parameters (single grid point).}
\fit{w3sin2}{Calculation of $S_{in}$.}
\fit{w3sds2}{Calculation of $S_{ds}$.}
\fit{inptab}{Generation of the interpolation table for $\beta$.}
\fit{w3beta}{Function to calculate $\beta$ (internal).}
\end{flisti}

\noindent
Input and dissipation module \wam-4 and ECWAM. \hfill {\file w3src3md.ftn}

\begin{flisti}
\fit{w3spr3}{Calculation of mean wave parameters (single grid point).}
\fit{w3sin3}{Calculation of $S_{in}$.}
\fit{w3sds3}{Calculation of $S_{ds}$.}
\fit{tabu\_stress}{Tabulation of wind stress as a function of $U_{10}$ and $\tau_w$}
\fit{tabu\_tauhf}{Tabulation of the short waves-supported stress}
\fit{calc\_ustar}{Computes friction velocity using stress table}
\end{flisti}

\noindent
Input and dissipation module Ardhuin et al. 2010 \hfill {\file w3src4md.ftn}

\begin{flisti}
\fit{w3spr4}{Calculation of mean wave parameters (single grid point).}
\fit{w3sin4}{Calculation of $S_{in}$.}
\fit{w3sds4}{Calculation of $S_{ds}$.}
\fit{tabu\_stress}{Tabulation of wind stress as a function of $U_{10}$ and $\tau_w$}
\fit{tabu\_tauhf}{Tabulation of the short waves-supported stress}
\fit{tabu\_tauhf2}{Tabulation of the short waves-supported stress with sheltering}
\fit{tabu\_swellft}{Tabulation of oscillatory friction factor for negative part of $S_{in}$.}
\fit{calc\_ustar}{Computes friction velocity using stress table}
\end{flisti}

\noindent
Input and dissipation module BYDRZ \hfill {\file w3src6md.ftn}

\begin{flisti}
\fit{w3spr6  }{Integral parameter calculation following {\F st1}.}
\fit{w3sin6  }{Observation-based wind input.}
\fit{w3sds6  }{Observation-based dissipation.}
\fit{irange  }{Generate a sequence of integer values.}
\fit{lfactor }{Calculate reduction factor for Sin.}
\fit{tauwinds}{Normal stress calculation for Sin.}
\fit{polyfit2}{Quadratic fit using least-squares.}
\end{flisti}

\noindent
Input and dissipation module (slot for user supplied routines) \hfill {\file
w3srcxmd.ftn}

\begin{flisti}
\fit{w3sinx}{Calculation of $S_{in}$.}
\fit{w3sdsx}{Calculation of $S_{ds}$.}
\end{flisti}

\noindent
Swell dissipation module \hfill {\file w3swldmd.ftn}

\begin{flist}
\fit{w3swl4}{Ardhuin et al (2010+) swell dissipation.}
\fit{w3swl6}{Babanin (2011) swell dissipation.}
\fit{irange}{Generate a sequence of integer values.}
\end{flist}

\noindent
Nonlinear interaction module (\dia) \hfill {\file w3snl1md.ftn}

\begin{flisti}
\fit{w3snl1}{Calculation of $S_{nl}$.}
\fit{insnl1}{Initialization for $S_{nl}$.}
\end{flisti}

\noindent
Nonlinear interaction module (\xnl) \hfill {\file w3snl2md.ftn}

\begin{flisti}
\fit{w3snl2}{Interface routine for $S_{nl}$.}
\fit{insnl2}{Initialization for $S_{nl}$.}
\end{flisti}
These routines provide the interface to the \xnl\ routines. The \xnl\ routines
are provided in the files {\file mod\_constants.f90}, {\file mod\_fileio.f90},
{\file mod\_xnl4v4.f90}, and {\file serv\_xnl4v4.f90}. For details on these
files, see \cite{rep:vVl02b}.

\vspace{\baselineskip}
\noindent
Nonlinear interaction module (GMD) \hfill {\file w3snl3md.ftn}

\begin{flisti}
\fit{w3snl3}{Calculation of $S_{nl}$.}
\fit{expand}{Expand spectral space.}
\fit{expan2}{Map form expanded to original spectral space.}
\fit{insnl3}{Initialization for $S_{nl}$.}
\end{flisti}

\vspace{\baselineskip}
\noindent
Nonlinear interaction module (slot for user supplied routines) \hfill {\file
w3snlxmd.ftn}

\begin{flisti}
\fit{w3snlx}{Calculation of $S_{nl}$.}
\fit{insnlx}{Initialization for $S_{nl}$.}
\end{flisti}

\vspace{\baselineskip}
\noindent
Nonlinear high-frequency filter \hfill {\file w3snlsmd.ftn}

\begin{flisti}
\fit{w3snls}{Calculation of filter.}
\fit{expand}{Expand spectral space.}
\fit{insnls}{Initialization for filter.}
\end{flisti}

\noindent
Bottom friction module (\js) \hfill {\file w3sbt1md.ftn}

\begin{flisti}
\fit{w3bt1}{Calculation of $S_{bot}$.}
\end{flisti}

\noindent
Bottom friction module (\showex) \hfill {\file w3sbt4md.ftn}

\begin{flisti}
\fit{insbt4}{Initialization of $S_{bot}$})
\fit{tabu\_erf}{Table or error function.} 
\fit{w3sbt4}{Calculation of $S_{bot}$, and energy and momentum fluxes to the 
bottom boundary layer.}
\end{flisti}

\noindent
Fluid mud dissipation \citep{art:DL78}  \hfill {\file w3sbt8md.ftn}

\begin{flisti}
\fit{w3sbt8}{Source term.}
\end{flisti}

\pb \noindent
Fluid mud dissipation \citep{art:Ng00}  \hfill {\file w3sbt9md.ftn}

\begin{flisti}
\fit{w3sbt9}{Source term.}
\end{flisti}

\noindent
Bottom friction module (slot for user supplied routines) \hfill {\file
w3sbtxmd.ftn}

\begin{flisti}
\fit{w3sbtx}{Calculation of $S_{bot}$.}
\fit{insbtx}{Initialization of $S_{bot}$.}
\end{flisti}

\noindent
Depth induced breaking module (Battjes-Janssen) \hfill {\file w3sdb1md.ftn}

\begin{flisti}
\fit{w3sdb1}{Calculation of $S_{db}$.}
\end{flisti}

\noindent
Depth induced breaking module (slot for user supplied routines) \hfill {\file
w3sdbxmd.ftn}

\begin{flisti}
\fit{w3sdbx}{Calculation of $S_{db}$.}
\fit{insdbx}{Initialization of $S_{db}$.}
\end{flisti}

\noindent
Triad interactions module (LTA) \hfill {\file w3str1md.ftn}

\begin{flisti}
\fit{w3str1}{Calculation of $S_{tr}$.}
\end{flisti}

\noindent
Triad interactions module (slot for user supplied routines) \hfill {\file
w3strxmd.ftn}

\begin{flisti}
\fit{w3strx}{Calculation of $S_{tr}$.}
\fit{instrx}{Initialization of $S_{tr}$.}
\end{flisti}

\noindent
Bottom scattering module \hfill {\file w3sbs1md.ftn}

\begin{flisti}
\fit{w3sbs1}{Calculation of $S_{bs}$ and associated momentum flux to the
             bottom.}  
\fit{insbs1}{Initialization of $S_{bs}$.}
\end{flisti}

\noindent
Bottom scattering module (slot for user supplied routines) \hfill {\file
w3sbsxmd.ftn}

\begin{flisti}
\fit{w3sbsx}{Calculation of $S_{bs}$.}
\fit{insbsx}{Initialization of $S_{bs}$.}
\end{flisti}

\pb \noindent
Wave-ice interactions (simple) \hfill {\file w3sic1md.ftn}

\begin{flisti}
\fit{w3sic1}{Calculation of $S_{id}$.}
\end{flisti}

\noindent
Wave-ice interactions (Liu et al.) \hfill {\file w3sic2md.ftn}

\begin{flisti}
\fit{w3sic2}{Calculation of $S_{id}$.}
\fit{      }{Interpolation tables.}
\end{flisti}

\noindent
Wave-ice interactions \cite{art:WS10} \hfill {\file w3sic3md.ftn}

\begin{flisti}
\fit{w3sic3}{Calculation of $S_{id}$.}
\fit{bsdet }{Calculate the determinant for the dispersion relation.}
\fit{wn\_complex}{Calculate complex wavenumber in ice.}
\fit{cmplx\_root\_muller}{Find root for complex numbers.}
\fit{fun\_zhao}{Wrapper for functions below.}
\fit{func0\_zhao, finc1\_zhao}{}
\end{flisti}

\begin{flisti}
\fit{w3sis2}{Calculation of $S_{is}$.}
\end{flisti}

\noindent
Waves scattering in ice and ice break-up \hfill {\file w3sis2md.ftn}

\noindent
Shoreline reflection \hfill {\file w3ref1md.ftn}

\begin{flisti}
\fit{w3ref1}{Calculation of $S_{ref}$.}
\end{flisti}

\noindent
Module for unclassified source term (slot for user supplied routines) \hfill
{\file w3sxxxmd.ftn}

\begin{flisti}
\fit{w3sxxx}{Calculation of $S_{xx}$.}
\fit{insxxx}{Initialization of $S_{xx}$.}
\end{flisti}

\noindent
To complete the basic wave model, several additional modules are needed. For
the actual contents of the service modules see the documentation in the source
code files.

\begin{flist}
\fit{constants.ftn}{Physical and mathematical constants and Kelvin functions.}
%\begin{flisti}
%\fit{kzeone}{Pre-calculation for Kelvin functions}
%\fit{kerkei}{Calculation of Kelvin functions}
%\end{flisti}

\fit{w3arrymd.ftn}{Array manipulation routines including
                   'print plot' routines.}
\fit{w3bullmd.ftn}{Perform bulletin style output for output points.}
\fit{w3cspcmd.ftn}{Conversion of spectral discretization.}
\fit{w3dispmd.ftn}{Routines to solve the Laplace dispersion relation (linear waves, flat bottom, no ice),
                   including interpolation tables. Includes also ice corrections in liu\_foreward\_dispersion and liu\_inverse\_dispersion.}
\fit{w3gsrumd.ftn}{Regridding utilities.}
\fit{w3partmd.ftn}{Perform spectral partitioning for a single spectrum.}
\fit{w3servmd.ftn}{General service routines.}
\fit{w3timemd.ftn}{Time management routines.}
\fit{w3triamd.ftn}{Basic routines for triangle-based grids: reading, 
                   interpolation, definition of miscellaneous arrays, determination of boundary
                   points.}
\end{flist}

\noindent
This completes the description of the basic wave model routines. The relation
between the initialization routine and other routines is illustrated in
Fig.~\ref{fig:w3init}. %  (page~\pageref{fig:w3init}). 
A similar relational
diagram for the wave model routine is presented in Fig.~\ref{fig:w3wave}. 
% (page~\pageref{fig:w3wave}).
   
% fig:w3init
% fig:w3wave

\input{sys/fig_w3init}

\input{sys/fig_w3wave}
